package com.photoeditor.demo.ui.widget.image.magazine;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.RectF;
import android.view.View;


public class EditMagazineCoverView extends View {
    private Paint mBgPaint;
    private RectF mAllChildRect;
    Bitmap coverBitmap;
    private Matrix mMatrix;

    public EditMagazineCoverView(Context context, Bitmap coverBitmap, RectF outSideRect) {
        super(context);
        this.coverBitmap = coverBitmap;
        init(outSideRect);
    }

    private void init(RectF outSideRect) {
        mBgPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
        mBgPaint.setStyle(Paint.Style.FILL);
        mAllChildRect = new RectF();
        mAllChildRect = outSideRect;
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawBitmap(coverBitmap, null, mAllChildRect, mBgPaint);
    }
}
